home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
unix
/
textmstr.shr
/
tm.hqx
/
Source Code ƒ
/
U
/
EventsTextMaster.c
< prev
next >
Wrap
Text File
|
1991-05-09
|
4KB
|
114 lines
/* EventsTextMaster Additional event handler routines
File name: EventsTextMaster.c
Function: This module contains the extra event handler routines
These routines allow us to override events in the main loop,
and to handle unique events.
/* History: 5/9/91 Original by Prototyper 3.0 */
#include "PCommonTextMaster.h" /* Common */
#include "Common_TextMaster.h" /* Common */
#include "PUtils_TextMaster.h" /* General Utilities */
#include "Utils_TextMaster.h" /* General Utilities */
#include "EventsTextMaster.h" /* This file */
/* ======================================================= */
/* Routine: HandleKey */
/* Purpose: Allow us to filter key strokes and special key combinations. */
/* Return TRUE if we let the main loop handle the key stroke, return */
/* FALSE if we handle it and want the main loop to ignore it. */
Boolean HandleKey(myevent)
EventRecord *myevent;
{
short charCode; /* Key code */
char ch; /* Key pressed in Ascii */
Boolean CmdKeyPressed; /* Command key pressed */
Boolean OptionKeyPressed; /* Option key pressed */
Boolean ShiftKeyPressed; /* Shift key pressed */
Boolean theHandleKey; /* value to return */
theHandleKey = TRUE; /* Let the main loop handle it */
charCode = myevent->message & charCodeMask; /* Get the character */
ch = (char)charCode; /* Change it to ASCII */
CmdKeyPressed = ((myevent->modifiers & cmdKey) != 0); /* See if Command key is down */
OptionKeyPressed = ((myevent->modifiers & optionKey) != 0);/* See if Option key is down */
ShiftKeyPressed = ((myevent->modifiers & shiftKey) != 0);/* See if Shift key is down */
return(theHandleKey); /* Return if we let main routine handle it */
}
/* ======================================================= */
/* Routine: HandleDisk */
/* Purpose: Allow us to handle disk inserted events specially. */
/* Return TRUE if we let the main loop handle the key stroke, return */
/* FALSE if we handle it and want the main loop to ignore it. */
Boolean HandleDisk(myevent)
EventRecord *myevent;
{
Boolean theHandleDisk; /* value to return */
theHandleDisk = TRUE; /* Let the main loop handle it */
return(theHandleDisk); /* Return if we let main routine handle it */
}
/* ======================================================= */
/* Routine: ApplLoop_TextMaster */
/* Purpose: At the top of the main loop, called each time thru the main */
/* loop. This is very often if WNE was false. If WNE was true then */
/* how often this routine is called depends on the setting of SleepValue */
/* in the ApplInit routine. */
void ApplLoop_TextMaster()
{
}
/* ======================================================= */
/* Routine: ApplEvent_TextMaster */
/* Purpose: Allow us to filter all events before the main loop handles them. */
/* Set DoIt to TRUE to let the main loop handle the event. Set DoIt to */
/* FALSE if we handle it and want the main loop to ignore it. */
void ApplEvent_TextMaster(DoIt, myEvent)
Boolean *DoIt;
EventRecord *myEvent;
{
*DoIt = TRUE; /* Let the main loop handle it */
if (myEvent->what == app4Evt) /* Handle a Suspend or Resume event*/
{
*DoIt = FALSE; /* Tell the main loop to skip it*/
}
else if (myEvent->what == 0) /* Handle a NULL event*/
{
*DoIt = FALSE; /* Tell the main loop to skip it*/
}
}
/* ======================================================= */
/* Routine: Handle_UserEvent */
/* Purpose: Handle our special user events */
void Handle_UserEvent(TheUserEvent)
UserEventRec *TheUserEvent;
{
}
/* ======================================================= */